﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CoreRay.Client
{
    /// <summary>
    /// Interaction logic for LogWindow.xaml
    /// </summary>
    public partial class LogWindow : Window
    {
        public LogWindow()
        {
            InitializeComponent();

            LogWindowReceiver logReceiver = new LogWindowReceiver(this);
            CoreRayContext.Current.LogManager.AddLogReceiver(logReceiver);

            this.Closing += new System.ComponentModel.CancelEventHandler(LogWindow_Closing);
        }

        void LogWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }

        public void WriteLog(string message, string category, LogInformationTypes messageInformationType)
        {
            this.logTextBlock.Text += message + "\n";
        }
    }
}
